package reflect;

import java.lang.reflect.Constructor;

public class Test {
    public static void main(String[] args) throws Exception{
        Class cls = Class.forName("reflect.Student");
        Constructor constructor = cls.getConstructor();
        Object obj = constructor.newInstance();
        System.out.println(obj);//Student{name='null', age=0, gender= }

        Constructor constructor1 = cls.getConstructor(String.class,int.class,char.class);
        Object obj1 = constructor1.newInstance("sjh",24,'男');
        System.out.println(obj1);//Student{name='sjh', age=24, gender=男}
    }
}
